]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Try harder to find a matching layout
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 16 Nov 2019 12:48:35 +0000 (13:48 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 16 Nov 2019 15:12:06 +0000 (16:12 +0100)
While we support a reasonable list of layouts nowadays, we don't
include many variants like `fr+oss`. Instead of directly falling
back to the `us` layout, try stripping the variant first, as the
base layout is likely closer to the expectation than `us`.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1907

js/ui/keyboard.js

index 8e1f34bacc972378bd7e28434efdac010bdfda3e..c6984cc36d0baf710837fa2232e4056d894c92d4 100644 (file)
@@ -478,10 +478,17 @@ var Key = GObject.registerClass({
 
 var KeyboardModel = class {
     constructor(groupName) {
-        try {
-            this._model = this._loadModel(groupName);
-        } catch (e) {
-            this._model = this._loadModel('us');
+        let names = [groupName];
+        if (names.includes('+'))
+            names.push(groupName.replace(/\+.*/, ''));
+        names.push('us');
+
+        for (let i = 0; i < names.length; i++) {
+            try {
+                this._model = this._loadModel(names[i]);
+                break;
+            } catch (e) {
+            }
         }
     }